﻿@model KnowledgeCommunity.Model.Commodity

@{
    ViewBag.Title = "Details";
}


<div class="path one columns">商品创意</div>

<div class="columns three-fourths">
    <div class="post">
    <div class="image"><img src="@Url.Content(Model.Logo)" alt="featured_image" /></div>
    <div class="postinfo">
        <div class="clear"></div>
        <div class="title">快捷检索</div>
        <ul>
            @foreach (var item_l in (IEnumerable<KnowledgeCommunity.Model.Catalog>)ViewData["_Calalogs"])
            {
                <li><a href="@Url.Action("Items", "Community", new { type = item_l.CatalogNo })">@item_l.Title</a></li>
            }
        </ul>
    </div>
    <div class="resume">
        <h3>商品简介</h3>
        @(new MvcHtmlString(Model.Content))
        <div class="clear"></div>
    </div>
    </div>

    <div id="comments">
    <h2>4 Comments</h2>
    @foreach (var item in (IEnumerable<KnowledgeCommunity.Model.Comment>)ViewData["CommentList"])
    {
        <div class="comment">
            <div class="line"></div>
            <div class="image"><img src="@Url.Content("~/Content/images/user_1.png")" alt="user" /></div>
            <div class="commentcontent">
            <div class="date"> <a href="#">Replay</a> @item.AddTime.ToShortTimeString() by @item.UserName </div>
            <p>@item.Content</p>
            </div>
        </div>
    }
    <div class="clear"></div>

    <div class="commentform">
        @using (Html.BeginForm("CommentCreate", "Commodity", FormMethod.Post, new { enctype = "multipart/form-data" }))
        {
            @Html.ValidationSummary(true)
            @Html.HiddenFor(model => model.Id)
            @Html.HiddenFor(model => model.ShapeCode)
            <p>评论</p>
                <textarea id="message" name="message" cols="10" rows="10"></textarea>
            <br/>
            <input class="button" name="Send" type="submit" value="Comment" />
        }
    </div>
    </div>

</div>

<div class="columns four_last">
  <div class="sidebar">
    
    <div class="title">商品名称： @Model.Title</div>
    <div class="title">商品数量： @Model.Count</div>
    <div class="title">商品价格： @Model.CurrentPrice</div>
    <div class="title">发布者： @Model.UserName</div>
    <div class="title">发布时间： @Model.AddTime.ToString("yyyy-mm-dd")</div>
    <ul>
        <li><a href="@Url.Action("Buy", "Shop", new { id = Model.Id })">购买</a></li>
        @{
            if (HttpContext.Current.User.IsInRole("admin") || HttpContext.Current.User.IsInRole("editor"))
            {
                <li><a href="@Url.Action("Edit", "Commodity", new { id = Model.Id })">编辑</a></li> 
                <li><a href="@Url.Action("Delete", "Commodity", new { id = Model.Id })">删除</a></li> 
            }
        }
    </ul>   
  </div>
</div>
<div class="clear"></div>